﻿using Microsoft.Extensions.AI;
using OllamaSharp;

namespace DeepSeekLearn
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Chart();

            Console.ReadLine();
        }

        static async Task Chart()
        {
            Uri modelEndpoint = new("http://localhost:11434");

            //指定模型
            string modelName = "deepseek-r1:1.5b";

            var chatClient = new OllamaApiClient(modelEndpoint, modelName);

            //提问
            string question = "我是编程小白，应该如何学习编程？";
            var response = chatClient.GetStreamingResponseAsync(question);

            Console.WriteLine($">>> 你: {question}");
            Console.Write(">>>");
            Console.WriteLine(">>> DeepSeek: ");

            //输出
            await foreach (var item in response)
            {
                Console.Write(item);
            }
        }
    }
}
